package com.zhouxin.customview

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import com.zhouxin.customview.activitys.*
import com.zhouxin.customview.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity(), View.OnClickListener {
    private lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView<ActivityMainBinding>(this, R.layout.activity_main)
//        setContentView(R.layout.activity_main)
        binding.btnTest.setOnClickListener(this)
        binding.btnDashBoard.setOnClickListener(this)
        binding.btnPieView.setOnClickListener(this)
        binding.btnAvatarView.setOnClickListener(this)
        binding.btnXfermodeView.setOnClickListener(this)
        binding.btnSportView.setOnClickListener(this)
        binding.btnMultilineView.setOnClickListener(this)
        binding.btnCameraView.setOnClickListener(this)
        binding.btnAnimatorView.setOnClickListener(this)
        binding.btnSquareImageView.setOnClickListener(this)
        binding.btnCircleView.setOnClickListener(this)
        binding.btnGameRockerView.setOnClickListener(this)
    }

    override fun onClick(v: View) {
        when (v.id) {
            R.id.btnTest -> startActivity(Intent(this, TestActivity::class.java))
            R.id.btnDashBoard -> startActivity(Intent(this, DashBoardActivity::class.java))
            R.id.btnPieView -> startActivity(Intent(this, PieViewActivity::class.java))
            R.id.btnAvatarView -> startActivity(Intent(this,AvatarActivity::class.java))
            R.id.btnXfermodeView -> startActivity(Intent(this,XfermodeActivity::class.java))
            R.id.btnSportView -> startActivity(Intent(this, SportViewActivity::class.java))
            R.id.btnMultilineView -> startActivity(Intent(this, MultilineActivity::class.java))
            R.id.btnCameraView -> startActivity(Intent(this,CameraActivity::class.java))
            R.id.btnAnimatorView -> startActivity(Intent(this,AnimatorActivity::class.java))
            R.id.btnSquareImageView -> startActivity(Intent(this,SquareImageViewActivity::class.java))
            R.id.btnCircleView -> startActivity(Intent(this,CircleViewActivity::class.java))
            R.id.btnGameRockerView -> startActivity(Intent(this,GameRockerActivity::class.java))
        }
    }
}